TidyPlatesThemeList["Graphite"] = {}
local theme = TidyPlatesThemeList["Graphite"]
local path = "Interface\\Addons\\TidyPlates_Graphite" 

local artwidth = 128
local borderheight = 16
local barheight = 16
local widthfactor = .6
local heightfactor = .8


theme.healthborder = {
	texture	= path.."\\HealthBorder",
	glowtexture 			= path.."\\HealthBorder",
	elitetexture = path.."\\HealthBorder",
	width = artwidth*widthfactor,
	height = borderheight*heightfactor,
	x = 0,
	y = 0,
}

theme.healthbar = {
	texture 				= path.."\\StatusBar",
	width = 98*widthfactor,
	--width = 96*widthfactor,
	height = barheight*heightfactor,
	x = 0,
	y = 0,
}

theme.threatborder = {
	texture = path.."\\Empty",
	elitetexture = path.."\\Empty",
}

theme.castborder = {
	texture	= path.."\\HealthBorder",
	glowtexture 			= path.."\\HealthBorder",
	elitetexture = path.."\\HealthBorder",
	width = artwidth*widthfactor,
	height = borderheight*heightfactor,
	anchor = "CENTER",
	x = 0,
	y = -6,
}

theme.castbar = {
	texture 				= path.."\\StatusBar",
	width = 96*widthfactor,
	height = barheight*heightfactor,
	anchor = "CENTER",
	x = 0,
	y = -6,
}

theme.spellicon = {
	size = 14,
	x = -50,
	y = -15,
}

theme.specialText = {
	size = 10,
	width = 175,
	height = 14,
	x = 0,
	y = 9,
	align = "CENTER",
	anchor = "CENTER",
	--flags = "",
	shadow = false,
}

theme.name = {

	typeface = "Interface\\Addons\\TidyPlates_Neon\\Media\\Qlassik_TB.ttf",
	
	size = 10,
	width = 175,
	height = 14,
	x = 0,
	--y = 9,
	y = -7,
	align = "CENTER",
	anchor = "CENTER",
	vertical = "CENTER",
	--flags = "",
	shadow = false,
}

theme.specialText = {
	size = 10,
	width = 175,
	height = 14,
	x = 0,
	y = -15,
	align = "CENTER",
	anchor = "CENTER",
	vertical = "CENTER",
	--flags = "",
	shadow = false,
}



theme.raidicon = {
	width = 18,
	height = 18,
	x = 0,
	y = 0,
	anchor = "LEFT",
}

theme.frame = {
	x = 0,
	y = 13,
}

theme.hitbox = {
	width = 100,
	height = 35,
}


theme.options = {
	showSpecialText = true,
	showLevel = false,
	showSpellIcon = false,
}


local function SpellText(unit)
	local spellname
	if unit.isCasting then 
		spellname = UnitCastingInfo("target") or UnitChannelInfo("target")
		return spellname
	else return "" end
end

theme.SetSpecialText = SpellText


--[[
theme.options = {
	showLevel = false,
	showName = false,
	showSpecialText = true,
	useCustomHealthbarColor = true,
	showSpellIcon = false,
}

-- Hex Colors
local OrangeHexColor = "|cFFfc551b"
local GreenHexColor = "|cFF3cff28"
local RedHexColor = "|cFFFF0000"
local GoldHexColor = "|cFFfcb41b"
local PaleBlueHexColor = "|cFF5cb8ff"

local dec2hex = {
	["0"] = "0",
	["1"] = "1",
	["2"] = "2",
	["3"] = "3",
	["4"] = "4",
	["5"] = "5",
	["6"] = "6",
	["7"] = "7",
	["8"] = "8",
	["9"] = "9",
	["10"] = "A",
	["11"] = "B",
	["12"] = "C",
	["13"] = "D",
	["14"] = "E",
	["15"] = "F"
}
	
local function FracToHex(frac)
	local val1, val2 = floor((frac*255)/16), floor(mod(frac*255, 16))
	local str = dec2hex[tostring(val1)]..dec2hex[tostring(val2)]
	return str
end

local function NameTextDelegate(unit)
	local r, g, b = unit.red, unit.green, unit.blue
	r=(r*.5)+.5
	g=(g*.5)+.5
	b=(b*.5)+.5
	--return GreenHexColor..unit.name
	return "|cFF"..FracToHex(r)..FracToHex(g)..FracToHex(b)..unit.name
end

-- RGB Colors
local BlueColor = {0, 123/256, 1}

local function HealthColorDelegate(unit)
	local r, g, b = unit.red, unit.green, unit.blue
	r=(r*.5)+.5
	g=(g*.5)+.5
	b=(b*.5)+.5
	--return unpack(BlueColor)
	return r,g,b
end

theme.SetSpecialText = NameTextDelegate
--theme.SetSpecialText2 = HealthTextDelegate
theme.SetHealthbarColor = HealthColorDelegate

--]]

local function HealthColorDelegate(unit)
	local r, g, b = unit.red, unit.green, unit.blue
	if unit.isTarget or (not UnitExists("target")) then
		return r, g, b
	else
		r=(r*.5)
		g=(g*.5)
		b=(b*.5)
		--return unpack(BlueColor)
		return r,g,b
	end
	

end

--theme.SetHealthbarColor = HealthColorDelegate

local function SetScaleDelegate(unit)
	return 1.2
end

theme.SetScale = SetScaleDelegate